﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<% UI.Data.SPORTSALEEntities context =  new UI.Data.SPORTSALEEntities(); %>

<% if (UI.Helpers.MySession.Current.UserId != 0) { %>
    Bienvenido, <%: Html.ActionLink(context.Usuarios.Where(x => x.Id == UI.Helpers.MySession.Current.UserId).First().Username, "Manage", "Account", routeValues: new { userId = UI.Helpers.MySession.Current.UserId }, htmlAttributes: new { @class = "username", title = "Manage" })%>!
    <% using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) { %>
        <%: Html.AntiForgeryToken() %>
        <a class="btn btn-danger" href="javascript:document.getElementById('logoutForm').submit()">Cerrar sesión</a>
    <% } %>
<% } else { %>
    <ul>
        <li><%: Html.ActionLink("Registrarse", "Create", "Account", routeValues: null, htmlAttributes: new { id = "registerLink", @class="btn btn-primary" })%></li>
        <li><%: Html.ActionLink("Iniciar Sesion", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink", @class = "btn btn-primary" })%></li>
    </ul>
<% } %>